﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using YhmOA.Common;
using System.Diagnostics;
using System.Data;
using System.Data.SqlClient;

namespace YhmOA
{
    public partial class _Default : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            MenuConfig.GetLeftMenu("个人办公");
        }

        [AjaxMethod]
        public string Say()
        {
            return null;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            
        }

        /// <summary>
        /// 拼接查询字符串
        /// </summary>
        /// <param name="showColumns">需要查询的列</param>
        /// <param name="keyword">查询关键字</param>
        /// <returns></returns>
        public string GetWhereString(string showColumn, string keyword)
        {

            string ruturnstring = "";
            if (keyword.IndexOf("+") > -1 || keyword.IndexOf("|") > -1)//如果为多个关键字
                ruturnstring = ruturnstring + " LIKE '%" + keyword.Replace("+", "%' AND " + ruturnstring + " LIKE '%").Replace("|", "%' OR " + ruturnstring + " LIKE '%") + "%'";
            else//如果只有一个关键字
                ruturnstring = ruturnstring + " LIKE '%" + keyword + "%'";

            return ruturnstring;


            //tablename = tablename.Trim();
            ////
            //string sql = "SELECT * FROM [syscolumns] WHERE [ID] = (SELECT [id] FROM [sysobjects] WHERE [name] = '" + tablename + "') AND ([xtype]<>173 AND [xtype]<>34 AND [xtype]<>59 AND [xtype]<>98 AND [xtype]<>189 AND [xtype]<>36)";//
            //DataSet ds = new DataSet();
            //using (SqlConnection con = new SqlConnection("server=.;database=YhmOA;uid=sa;pwd=lgh-123456;"))
            //{
            //    SqlDataAdapter sd = new SqlDataAdapter(sql, con);
            //    sd.Fill(ds);
            //}

        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            this.TextBox3.Text = GetWhereString("ID_userName_userAge_userSex", "zy+123|asd");
        }
    }

    
}